package com.tanhua.app.service;

import com.tanhua.api.UserApi;
import com.tanhua.app.interceptor.UserHolder;
import com.tanhua.model.pojo.User;
import com.tanhua.model.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {

    @DubboReference
    private UserApi userApi;

    //查询当前用户的环信账号和密码
    public HuanXinUserVo findHuanXinUser() {
        //1 根据当前用户id查询 用户数据
        User user = userApi.findById(UserHolder.getUserId());

        //2 封装返回vo
        HuanXinUserVo vo = new HuanXinUserVo();
        vo.setUsername(user.getHxUser());
        vo.setPassword(user.getHxPassword());

        //返回数据
        return vo;
    }
}
